﻿using System.Collections;
using NUnit.Framework;

namespace NUnit4PowerShell
{
    public class PSFixtureSuite
    {
        /// <summary>
        /// This property contains the fixture list to execute
        /// </summary>
        [Suite]
        public static IEnumerable Suite
        {
            get
            {
                // Set the fixture provider in a suite mode -> if not it will only take the first fixture found
                PSFixtureProvider.IsSuiteTest = true;
                Logger.Instance.Info("[AllPSFixtures] Start to look for Fixture to execute");
                var suite = new ArrayList();

                // We get all powershell files to execute from the folder specified in the configuration file
                var psFixtureFileListToExecute = Utils.GetPSFixtureFiles();
                foreach (string fixture in psFixtureFileListToExecute)
                {
                    Logger.Instance.Info(string.Format("[AllPSFixtures] Add fixture {0}", fixture));
                    suite.Add(typeof(PSFixture));
                }
                Logger.Instance.Info("[AllPSFixtures] End of the Fixture Suite definition");
                Logger.Instance.AddEmptyLine();

                return suite;
            }
        }
    }
}
